package etxt2db.annotators;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Set;

import edu.cmu.minorthird.classify.sequential.CRFLearner;
import edu.cmu.minorthird.text.TextLabels;
import edu.cmu.minorthird.text.learn.SpanFeatureExtractor;
import edu.cmu.minorthird.ui.Recommended;
import etxt2db.minorthird.MultiClassBeginContinueEndUniqueReduction;
import etxt2db.minorthird.MultiClassSequenceAnnotatorLearner;

public class MinorthirdCRFClassificationModel extends MinorthirdClassificationModel{
	/**
	 * 
	 */
	private static final long serialVersionUID = -7500146336555789268L;

	public MinorthirdCRFClassificationModel(TextLabels trainingFile,Set<Set<String>> compatibleAttributes) throws ParseException, IOException{
		this(trainingFile, new Recommended.TokenFE(),compatibleAttributes);
	}
	
	public MinorthirdCRFClassificationModel(TextLabels trainingFile, SpanFeatureExtractor tokenFE,Set<Set<String>> compatibleAttributes) throws ParseException, IOException{
		for(int i=0; i<compatibleAttributes.size();i++){
			learners.add(new MultiClassSequenceAnnotatorLearner(new CRFLearner(),tokenFE,
					new MultiClassBeginContinueEndUniqueReduction()));
		}
		this.compatibleAttributes = compatibleAttributes;
		ann = doTraining(trainingFile);
	}
}